/**
 * Created by jiangzhenzhen on 2016/5/19.
 */
/**
 * 显示弹出框（一般形式）
 * @param data：弹出框主体modal-body中的html
 * @param formId：data中form的id
 * @param title：弹出框标题
 * @param flag：弹出框标记（提交时，可指定不同的提交方法）
 * */
function showModel(data,title){
    $("#myModal .modal-body").html(data);
    $('#myModal .modal-title').html(title);
    $('#myModal').modal({ show: true, backdrop: 'static' });
}

/**
 * 显示弹出框（iframe形式）
 * @param url：弹出框访问地址
 * @param title：弹出框标题
 * @param width：弹出框宽度
 * @param height：弹出框高度
 * */
function showModelIframe(url,title,width,height){
    $("#myModalIframe .modal-body").html('<iframe id="myIframe" name="myIframe" width="100%" height="100%" frameborder="0" ></iframe>');
    $("#myIframe").attr("src", url);//新增地址
    $('#myModalIframe .modal-title').html(title);
    $('#myModalIframe').modal({ show: true, backdrop: 'static' });
    var mycss={"width":width+"px","height":height+"px","top":(($(window).height()-height)/2>0?($(window).height()-height)/2:0)+"px"};
    $('#myModalIframe .modal-dialog').css(mycss).find('.modal-content').css({height: '100%',width: '100%',overflow:'hidden'}).find('.modal-body').css({height: '100%' });
}

//关闭弹出框,并刷新DataTable表格数据
function closeModal(){
    $(".modal").modal('hide');
    document.getElementById('testIframe').contentWindow.refreshTable();//ajax刷新子页面中DataTable表格数据
}
//关闭弹出框
function simpleCloseModal(){
    $(".modal").modal('hide');
}
// 2018-08-15新增弹窗样式
function showNewModelIframe(url,width,height){
    $("#ModalIframe .modal-body").html('<iframe id="myNewIframe" name="myIframe" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>');
    $("#myNewIframe").attr("src", url);//新增地址
    $('#ModalIframe').modal({ show: true, backdrop: 'static' });
    var mycss={"width":width+"px","height":height+"px","top":(($(window).height()-height)/2>0?($(window).height()-height)/2:0)+"px"};
    $('#ModalIframe .modal-dialog').css(mycss).find('.modal-content').css({height: '100%',width: '100%'}).find('.modal-body').css({height: '100%' });
}

function showAlertlIframe(url,width,height){
    $("#ModalIframe .modal-body").append('<iframe id="myAlertIframe" name="myiframe" width="100%" height="100%" frameborder="0" scrolling="no"></iframe>');
    $("#myAlertIframe").attr("src", url);//新增地址
    $('#ModalIframe').modal({ show: true, backdrop: 'static' });
    var mycss={"width":width+"px","height":height+"px","top":(($(window).height()-height)/2>0?($(window).height()-height)/2:0)+"px"};
    $('#ModalIframe .modal-dialog').css(mycss).find('.modal-content').css({height: '100%',width: '100%'}).find('.modal-body').css({height: '100%' });
}
